﻿#ifndef MYSORTFILTERPROXYMODEL_H
#define MYSORTFILTERPROXYMODEL_H

#include <QtCore>
#include <QtSql>
#include <QSortFilterProxyModel>
#include <QSqlQueryModel>
#include <QTableView>

class myDataModel : public QSortFilterProxyModel
{
    Q_OBJECT

public:
    myDataModel(QObject *parent=0, QTableView *t=0, QString q="");
    void setHeader(QStringList header);
    void setQuery(QString q);
    QString getData(int i);
    void itemAdded();
    void itemChanged();

private:
    QString query;
    QSqlQueryModel *sqlModel;
    QTableView *table;


protected:
    bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const;
};


#endif // MYSORTFILTERPROXYMODEL_H
